package com.plian.system.wrapper.fr.evaluation;

import com.plian.system.dto.fr.evaluation.EvaluationApprovalDTO;
import com.plian.system.entity.fr.evaluation.EvaluationApproval;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.fr.evaluation.EvaluationApprovalVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 资产评估项目核准与备案包装类,返回视图层所需的字段
 *
 * @author jianglei
 * @since 2019-10-21
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface EvaluationApprovalWrapper extends BaseWrapper<EvaluationApproval, EvaluationApprovalDTO, EvaluationApprovalVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "possessionCompanyId", target = "possessionCompanyName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "enterpriseRankId", target = "enterpriseRankName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "groupDepartmentId", target = "groupDepartmentName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "activityTypeId", target = "activityTypeName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "evaluationRangeId", target = "evaluationRangeName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "institutionNameId", target = "institutionName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "approvedUser", target = "approvedUserName", qualifiedByName = USER_ID_TO_NAME),
	})
	EvaluationApprovalVO entityToVO(EvaluationApproval entity);


}
